﻿@model EmailIM
@{

    PageMeta pm = (PageMeta)ViewBag.PageMeta;
    ViewBag.Title = pm != null ? pm.Title : "联系我们";
}
@section header{
    @if (pm != null)
    {
        <meta name="description" content="@pm.Description" />
        <meta name="keywords" content="@pm.Keyword" />
    }
    <link href="~/Plugins/toastr/toastr.min.css" rel="stylesheet" />
    <style>
        #success-msg-container,
        #fail-msg-container {
            display: none;
        }
    </style>

}

<div class="container p-t-40">
    <header class="title">
        <h2 class="animated fadeInLeftBig">@ViewBag.Title</h2>
        <p class="animated fadeInRightBig">
            很高兴您们的来电联系反馈，我们会认真听取和改进我们的不足，谢谢您们。
        </p>
    </header>
</div>


    <div class="baidumap" id="map_canvas"></div>

<section class="container page-contact">
    <div class="row">
        <div class="col-sm-7 col-md-8 animated fadeInLeft sendform">
            <div class="contactform">

                <h3 class="title">
                    联系我们
                </h3>
                @using (Ajax.BeginForm("SendEmail", null, new AjaxOptions
            {

                HttpMethod = "POST",
                OnBegin = "onBeginSave",
                OnComplete = "onCompleteSave",
                OnSuccess = "updateSuccess"

            }, new { role = "form" }))
            {
                @Html.AntiForgeryToken()
                @Html.ValidationSummary(true)

                <div class="row dsl-form">
                    <div class="col-sm-12 form-group">

                        @Html.TextBoxFor(m => m.Name, new { @class = "form-control", placeholder = "姓名" })
                        @Html.ValidationMessageFor(model => model.Name)
                    </div>
                    <div class="col-sm-12 form-group">
                        @Html.TextBoxFor(m => m.Phone, new { @class = "form-control", placeholder = "联系电话" })
                        @Html.ValidationMessageFor(model => model.Phone)
                    </div>
                    <div class="col-sm-12 form-group">
                        @Html.TextBoxFor(m => m.Email, new { @class = "form-control", placeholder = "邮箱" })
                        @Html.ValidationMessageFor(model => model.Email)
                    </div>
                    <div class="col-sm-12 form-group">
                        @Html.TextAreaFor(m => m.Body, new { @class = "form-control", placeholder = "内容", rows = "8" })
                        @Html.ValidationMessageFor(model => model.Body)

                    </div>
                    <div class="col-sm-12 form-group">
                        <button type="submit" class="btn btn-primary">发送信息</button>
                    </div>
                </div>
        }
            </div>
        </div>
        <div class="col-sm-5 col-md-4  animated fadeInRight contactus p-t-15">

            <h3 class="title">
                联系方式
            </h3>

            <h4 class="setitle">+@SettingsManager.Contact.CompanyName</h4>
            <ul>
                <li>地址: @SettingsManager.Contact.Address</li>
                <li>电话: @SettingsManager.Contact.Phone</li>
                <li>联系人: @SettingsManager.Contact.ContactMan</li>

                <li>邮箱: <a href="mailto:@SettingsManager.Contact.MailTo">@SettingsManager.Contact.MailTo</a></li>
                <li>
                    业务QQ: <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=@SettingsManager.Social.Oicq&site=@SettingsManager.Site.SiteName&menu=yes">@SettingsManager.Social.Oicq</a>
                </li>
                <li>官方微博：<a href="@SettingsManager.Social.SinaWeibo">@SettingsManager.Social.SinaWeibo</a></li>

            </ul>
            <h4>+营业时间</h4>
            <ul>
                <li><i class="icon-time"></i> 周一至周六 上午9:00 ~ 下午6:00</li>
                <li><i class="icon-time"></i> 周日 关闭</li>
            </ul>

        </div>

    </div>
    </section>



    @section footer{
        @Scripts.Render("~/bundles/jqueryvalAjax")
        <script src="~/plugins/toastr/toastr.min.js"></script>
        <script>

    function onBeginSave() {
        $("#btnSave").text("发送中...");
    }
    function onCompleteSave() {
        $("#btnSave").text("提交");
    }

    function updateSuccess(data) {
        var title = '@ViewBag.Title';
      //  Common.ShowBox(data.Status, data.Message, title);

        switch (data.Status) {
            case 1:
                toastr.success(data.Message, title)
                break;
            case 2:
                toastr.error(data.Message, title)
                break;
            case 3:
                toastr.info(data.Message, title)
                break;
            case 4:
                toastr.warning(data.Message, title)
        }
    }

        </script>
        <script src="http://api.map.baidu.com/api?v=2.0&ak=G7h0sKsr60IFU3OrHRmKTRzD"></script>
        <script>
         // 百度地图API功能
    var map = new BMap.Map("map_canvas");


    map.addControl(new BMap.NavigationControl());
    map.enableScrollWheelZoom();    //启用滚轮放大缩小，默认禁用
    map.enableContinuousZoom();    //启用地图惯性拖拽，默认禁用

    map.centerAndZoom(new BMap.Point(114.072618, 22.803882), 16);
    var point = new BMap.Point(114.072618, 22.803882);

    var myIcon = new BMap.Icon("/Themes/Xipin/Content/img/marker.png", new BMap.Size(132, 132));
    var marker1 = new BMap.Marker(point, { icon: myIcon });  // 创建标注
    // var marker1 = new BMap.Marker(point);

    map.addOverlay(marker1);              // 将标注添加到地图中
    // marker1.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
    var sContent =
"<h4 style='margin:0 0 5px 0;padding:0.2em 0'>@SettingsManager.Contact.CompanyName</h4>" +
"<p>地址：@SettingsManager.Contact.Address <br/>" +
"电话：@SettingsManager.Contact.Phone</p>" +
"</div>";


    //创建信息窗口
    var infoWindow1 = new BMap.InfoWindow(sContent);
    marker1.addEventListener("click", function () { this.openInfoWindow(infoWindow1); });

    // marker1.openInfoWindow(infoWindow1);

        </script>
    }
